package feedback.web.bean.converter;

import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

import feedback.core.models.entities.Faculty;
import feedback.core.services.FacultyServices;
@ManagedBean(name="fccv")
public class FacultyConverter implements Converter {
	@ManagedProperty("#{fcsv}")
	private FacultyServices services;
	@Override
	public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
		Faculty tmp =services.getByNo(arg2);
		return tmp;
	}

	@Override
	public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
		
		return ((Faculty)arg2).getFacultyNo();
	}

	public FacultyServices getServices() {
		return services;
	}

	public void setServices(FacultyServices services) {
		this.services = services;
	}
	

}
